package com.sias.judgeservice.judge.codsandbox.impl;

import com.sias.judgeservice.judge.codsandbox.CodeSandbox;
import com.sias.model.model.codsandbox.ExecuteCodeRequest;
import com.sias.model.model.codsandbox.ExecuteCodeResponse;
import com.sias.model.model.codsandbox.JudgeInfo;
import com.sias.model.model.enums.JudgeInfoMessageEnum;
import com.sias.model.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * @author 吴文杰
 * @version 1.0
 * @since 2023/12/10 20:10
 */
public class ExampleCodeSandbox implements CodeSandbox {

  @Override
  public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
    List<String> inputList = executeCodeRequest.getInputList();
    ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
    executeCodeResponse.setOutputList(inputList);
    executeCodeResponse.setMessage("测试执行成功");
    executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());
    JudgeInfo judgeInfo = new JudgeInfo();
    judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
    judgeInfo.setMemory(100L);
    judgeInfo.setTime(100L);
    executeCodeResponse.setJudgeInfo(judgeInfo);
    return executeCodeResponse;
  }
}
